import { ref } from 'vue'
import { useEventBus } from '@vueuse/core'

export default function useLocation() {
  const location_list = ['全国', '北京', '上海', '广州', '深圳']
  const location = ref('全国')
  const search = useEventBus('search')

  watch(location, () => {
    search.emit({ location })
  })

  return {
    location_list,
    location,
  }
}